<?php
namespace app\index\controller;
use MsgCode\FictitiousPhone;
use PhpAmqpLib\Connection\AMQPStreamConnection;
use PhpAmqpLib\Message\AMQPMessage;

class Index
{
    public function index()
    {
        die();
        trace('接受数据：'.json_encode(input('')));
        $code = '200';$msg = '操作成功';$data = array();
        $data = input("key");
        if (empty($data)){
            $code='1001';
            $msg = "请求错误";
        }else{
            $phone = FictitiousPhone::init($data);
            if (is_string($phone)){
                $code='1001';
                $msg = $phone;
            }else
                $data =$phone->getPhone();
        }
        trace('接受数据：'.json_encode(array('code'=>$code,'msg'=>$msg,'data'=>$data)));
        return json(array('code'=>$code,'msg'=>$msg,'data'=>$data));
    }
}